import {fetch} from '../fetch'
import config from "@/config"

class Message {
  constructor() {
  }

  static list(params) {
    return fetch({
      url: config.baseUrl.adminSys + '/message/list',
      method: 'post',
      params
    })
  }

  static detail(params) {
    return fetch({
      url: config.baseUrl.adminSys + '/message/detail',
      method: 'post',
      params
    })
  }

  static add(params) {
    return fetch({
      url: config.baseUrl.adminSys + '/message/add',
      method: 'put',
      params
    })
  }

  static update(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/message/update/${params.id}`,
      method: 'post',
      params
    })
  }

  static delete(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/message/delete/${params.id}`,
      method: 'delete',
      params
    })
  }

  static getUnreadMessageCount(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/message/getUnreadMessageCount`,
      method: 'post',
      params
    })
  }

  static getUnreadCount(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/message/getUnreadCount`,
      method: 'post',
      params
    })
  }

  static getContentByMsgId(params) {
    return fetch({
      url: config.baseUrl.adminSys + '/message/getContentByMsgId',
      method: 'post',
      params
    })
  }

  static hasRead(params) {
    return fetch({
      url: config.baseUrl.adminSys + '/user/add',
      method: 'put',
      params
    })
  }

  static removeReaded(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/user/update/${params.id}`,
      method: 'post',
      params
    })
  }

  static restoreTrash(params) {
    return fetch({
      url: config.baseUrl.adminSys + `/user/delete/${params.id}`,
      method: 'delete',
      params
    })
  }
}

export default Message
